Page({ 
  data: {
    from_user: '',
    curModule: '',
  },
  onLoad(option) {
    if (option.scene) {
      let arr = option.scene.split(',');
      this.setData({
        from_user: arr[0],
        curModule: arr[1],
      });
    } else {
    if (option.from_user) {
      this.setData({
        from_user: option.from_user,
      });
    }
    if (option.curModule) {
      this.setData({
        curModule: option.curModule,
      });
    } else {
      // 获取模块名
      let pages = getCurrentPages();
      let prepage = pages[pages.length - 2];
      let curModule = prepage.route.split('/')[0];
      this.setData({
        curModule,
      });
    }
    }
  },

  shareMessage(e) {
    let { openid, title, imageUrl } = e.detail;
    this.setData({
      openid,
      title,
      imageUrl,
    });
  },

  // 转发
  onShareAppMessage: function () {
    return {
      // 在这里修改不同模块的路径
      title: this.data.title,
      imageUrl: this.data.imageUrl,
      path: `common/page/friend_help/friend_help?from_user=${this.data.openid}&curModule=${this.data.curModule}`,
    };
  },
});